// Copyright 2022 jeff.li. and/or its affiliates.

#include <tbir/pipeline/variable_op.h>

#include <tbir/pipeline/node.h>

namespace tbir::runtime {

    TBIR_REGISTER_NATIVE_OP(VariableOp);

    std::unique_ptr<Symbol> VariableOp::make_symbol(OpKernelPtr op,
                                                    String name,
                                                    runtime::RTValue data) {
        NodePtr node = Node::Create();
        node->op = op;
        NodeEntryPtr entry = std::make_shared<NodeEntry>();
        entry->node = node;
        entry->key = name;
        entry->index = 0;
        entry->data = std::move(data);
        node->name = std::move(name);
        std::vector<NodeEntryPtr> nes{entry};
        node->outputs = MakeNodeOutputs(nes);
        return std::make_unique<Symbol>(nes, 0);
    }

}  // namespace tbir::runtime
